package com.ibeeking.found.msg.rest.controller.v1;


import com.ibeeking.found.common.annotation.LoginUser;
import com.ibeeking.found.common.entity.CurrentUser;
import com.ibeeking.found.msg.rest.service.IWxMpAutoReturnMessageService;
import com.ibeeking.found.msg.service.common.param.WxMpAutoReturnMessageParam;
import com.ibeeking.found.msg.service.common.query.WxMpAutoReturnMessagePageQuery;
import com.ibeeking.found.msg.service.common.query.WxMpAutoReturnMessageQuery;
import com.ibeeking.found.msg.service.common.vo.WxMpAutoReturnMessageVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import com.ibeeking.nematos.utils.base.BaseValidationGroup;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 自动消息回复配置，已弃用
 * @ClassName WxmpAutoReturnMessageController控制器
 * @Description
 * @Author ibeeking
 * @Date 2021-01-25 15:36
 **/
@Deprecated
@RestController
@RequestMapping("/b/wxMp/autoReturnMsg/v1")
public class WxMpAutoReturnMessageController {

    @Resource
    private IWxMpAutoReturnMessageService wxMpAutoReturnMessageServiceImpl;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "")
    @PostMapping(value = "/list")
    public List<WxMpAutoReturnMessageVO> list(@RequestBody WxMpAutoReturnMessageQuery query) {
        return wxMpAutoReturnMessageServiceImpl.list(query);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "关键字自动回复配置分页查询")
    @PostMapping(value = "/pageList")
    public Page<WxMpAutoReturnMessageVO> pageList(@RequestBody WxMpAutoReturnMessagePageQuery pageQuery) {
        return wxMpAutoReturnMessageServiceImpl.pageList(pageQuery);
    }

    @Log(logType = OperateLogTypeEnum.SAVE, describe = "添加自动回复消息")
    @PostMapping(value = "/add")
    public Boolean add(@RequestBody @Validated(BaseValidationGroup.Insert.class) WxMpAutoReturnMessageParam param) {
        return wxMpAutoReturnMessageServiceImpl.add(param);
    }

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "修改自动回复消息")
    @PostMapping(value = "/modify")
    public Boolean modify(@RequestBody @Validated(BaseValidationGroup.Update.class) WxMpAutoReturnMessageParam param) {
        return wxMpAutoReturnMessageServiceImpl.modify(param);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "展示详情")
    @GetMapping(value = "/view/{id}")
    public WxMpAutoReturnMessageVO view(@PathVariable("id") Long id) {
        return wxMpAutoReturnMessageServiceImpl.view(id);
    }

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "修改自动回复消息的发布状态")
    @GetMapping(value = "/changeStatus/{id}/{status}")
    public Boolean changeStatus(@PathVariable("id") Long id, @PathVariable("status") Integer status) {
        return wxMpAutoReturnMessageServiceImpl.changeStatus(id, status);
    }

    @Log(logType = OperateLogTypeEnum.DEL, describe = "删除自动回复")
    @GetMapping(value = "/del/{id}")
    public Boolean del(@PathVariable("id") Long id) {
        return wxMpAutoReturnMessageServiceImpl.del(id);
    }


    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "修改除关键字以外的自动回复")
    @PostMapping(value = "/saveOther")
    public Boolean saveOther(@RequestBody @Validated(BaseValidationGroup.Update.class) WxMpAutoReturnMessageParam param) {
        return wxMpAutoReturnMessageServiceImpl.saveOther(param);
    }


}
